package cn.controller;

import cn.domain.Sysuser;
import cn.service.CustomerService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.service.UserService;

@Controller
public class UserController {
	@Autowired
	private UserService userService;
	@Autowired
	private CustomerService customerService;
	@RequestMapping("/login")
	public String login(@Param("userid") String userid, @Param("password") String password, Model model){
		String result="/login";
		Sysuser user = customerService.login(userid, password);

		if(user!=null )  return result="redirect:/list.action";

		model.addAttribute("msg", "账号或密码错误，请重新输入！");
		return result;
	}
}
